package leetcode.code0437;

import leetcode.IDebug;
import leetcode.helper.HelpDebug;
import leetcode.helper.tree.TreeArray;
import leetcode.helper.tree.TreeNode;

public abstract class Solution437 implements IDebug {

	public abstract int pathSum(TreeNode root, int targetSum);

	@Override
	public void debug1() {
		String str = "[10,5,-3,3,2,null,11,3,-2,null,1]";
		int targetSum = 8;
		int e = 3;
		int r = this.pathSum(TreeArray.array2tree(HelpDebug.str2array4(str)), targetSum);
		HelpDebug.compare(e, r);
	}

	@Override
	public void debug2() {
		String str = "[5,4,8,11,null,13,4,7,2,null,null,5,1]";
		int targetSum = 22;
		int e = 3;
		int r = this.pathSum(TreeArray.array2tree(HelpDebug.str2array4(str)), targetSum);
		HelpDebug.compare(e, r);
	}

	@Override
	public void debug3() {
		String str = "[-2,null,-3]";
		int targetSum = -5;
		int e = 1;
		int r = this.pathSum(TreeArray.array2tree(HelpDebug.str2array4(str)), targetSum);
		HelpDebug.compare(e, r);
	}

	@Override
	public void debug4() {
		String str = "[1,-2,-3]";
		int targetSum = -2;
		int e = 2;
		int r = this.pathSum(TreeArray.array2tree(HelpDebug.str2array4(str)), targetSum);
		HelpDebug.compare(e, r);
	}

	public void debug5() {
		String str = "[-2,null,-3]";
		int targetSum = -3;
		int e = 1;
		int r = this.pathSum(TreeArray.array2tree(HelpDebug.str2array4(str)), targetSum);
		HelpDebug.compare(e, r);
	}

	public void debug6() {
		String str = "[1,-1,null,-1,null,-2]";
		int targetSum = -2;
		int e = 2;
		int r = this.pathSum(TreeArray.array2tree(HelpDebug.str2array4(str)), targetSum);
		HelpDebug.compare(e, r);
	}

	public void debug7() {
		String str = "[0,1,1]";
		int targetSum = 1;
		int e = 4;
		int r = this.pathSum(TreeArray.array2tree(HelpDebug.str2array4(str)), targetSum);
		HelpDebug.compare(e, r);
	}

	public void debug8() {
		String str = "[1,-2,-3,1,3,-2,null,-1]";
		int targetSum = 0;
		int e = 2;
		int r = this.pathSum(TreeArray.array2tree(HelpDebug.str2array4(str)), targetSum);
		HelpDebug.compare(e, r);
	}

	public void debug9() {
		String str = "[1,2]";
		int targetSum = 1;
		int e = 1;
		int r = this.pathSum(TreeArray.array2tree(HelpDebug.str2array4(str)), targetSum);
		HelpDebug.compare(e, r);
	}

	public void debug10() {
		String str = "[1,-2,-3,1,3,-2,null,-1]";
		int targetSum = -1;
		int e = 4;
		int r = this.pathSum(TreeArray.array2tree(HelpDebug.str2array4(str)), targetSum);
		HelpDebug.compare(e, r);
	}

}
